<template v-if="goods.data">
	<view class="box" v-if="goods.style.column !== 1" :style="{backgroundColor:goods.style.background}">
		<view class="goodsitem two" :class="{three:goods.style.column === 3}" v-for="(item,index) in goods.data" :key="item.goods_id">
			<view class="top">
				<img class="productPic" :src="item.goods_image" alt="">
			</view>
			<view class="bottom">
				<view class="title" v-show="goods.style.show.includes('goodsName')">{{item.goods_name}}</view>
				<view class="showprice">
					<text class="price" v-show="goods.style.show.includes('goodsPrice')">¥ {{item.goods_price_max}}</text>
					<text class="linePrice" v-show="goods.style.show.includes('linePrice')">¥ {{item.line_price_max}}</text>
				</view>
			</view>
		</view>
	</view>
	<view class="goodslist" v-else :style="{backgroundColor:goods.style.background}">
		<view class="item" v-for="(item,index) in goods.data" :key="item.goods_id">
			<view class="left">
				<img class="image" :src="item.goods_image" alt="">
			</view>
			<view class="right">
				<view class="title" v-show="goods.style.show.includes('goodsName')">{{item.goods_name}}</view>
				<view class="discrip">{{item.selling_point}}</view>
				<view class="salenum">已售{{item.goods_sales}}件</view>
				<view class="price">
					<text class="goodsprice"  v-show="goods.style.show.includes('goodsPrice')">¥ {{item.goods_price_max}}</text>
					<text class="lineprice" v-show="goods.style.show.includes('linePrice')">¥ {{item.line_price_max}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { mapState } from 'vuex';
	export default {
		name:"my-goods",
		data() {
			return {
				
			};
		},
		computed:{
			...mapState('home',['goods'])
		}
	}
</script>

<style lang="scss" scoped>
.box{
	
	box-sizing: border-box !important;
	width: 750rpx;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-evenly;
	color: #5E5E5E;
	.goodsitem{
		&.two{
			width: 47%;
			.top{
				height: 360rpx;
			}
			.bottom{
				padding: 10rpx;
			}
		}
		&.three{
			width: 30%;
			.top{
				height: 235rpx;
			}
			.bottom{
				padding: 5rpx;
			}
		}
		height: 100%;
		background-color: #fff;
		font-size: 26rpx;
		margin: 8rpx;
		.top{
			width: 100%;
			.productPic{
				width: 100%;
				height: 100%;
			}
		}
		.bottom{
			.title{
				height: 70rpx;
				// white-space: nowrap;
				display:-webkit-box;
				-webkit-box-orient:vertical;
				-webkit-line-clamp:2;
				overflow: hidden;
				text-overflow: ellipsis;
			}
			.showprice{
				height: 42rpx;
				display: flex;
				justify-content: start;
				margin-top: 15rpx;
				.price{
					font-size: 30rpx;
					margin-right: 20rpx;
					color: indianred;
				}
				.linePrice{
					text-decoration:line-through;
				}
			}
		}
		
	}
}

.goodslist{
	box-sizing: border-box;
	padding: 10rpx;
	.item{
		display: flex;
		background-color: #fff;
		margin: 10rpx 0;
		.left{
			flex:4;
			width: 240rpx;
			height: 240rpx;
			.image{
				width: 100%;
				height: 100%;
				margin-right: 20rpx;
			}
		}
		.right{
			flex:6;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			margin-left: 40rpx;
			.title{
				margin-top: 20rpx;
				min-height: 68rpx;
				font-size: 26rpx;
				display: -webkit-box;
				word-break: break-all;
				text-overflow: ellipsis;
				overflow: hidden;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 2;
			}
			.discrip{
				width: 400rpx;
				font-size: 24rpx;
				color:#e49a3d;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
			.salenum{
				color: #999;
				font-size: 24rpx;
			}
			.price{
				.goodsprice{
					margin-right: 16rpx;
					color: #f03c3c;
					font-size: 30rpx;
				}
				.lineprice{
					text-decoration: line-through;
					font-size: 22rpx;
					color: #999;
				}
				
			}
		}
	}
}
</style>